package club.cearnach.api.annotation;

import club.cearnach.api.service.impl.MovieServiceImpl;
import club.cearnach.api.service.impl.MovieTypeServiceImpl;
import club.cearnach.api.service.impl.PersonServiceImpl;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Caching;

import java.lang.annotation.*;

/**
 * @author 阮胜
 * @date 2018/5/15 15:26
 */
@Caching(
        evict = {
                @CacheEvict(value = MovieServiceImpl.CACHE_MOVIE_NAME, allEntries = true),
                @CacheEvict(value = MovieServiceImpl.CACHE_MOVIE_FIND_ALL,allEntries = true),
                @CacheEvict(value = PersonServiceImpl.CACHE_PERSON_NAME, allEntries = true),
                @CacheEvict(value = PersonServiceImpl.CACHE_PERSON_FIND_ALL, allEntries = true),
                @CacheEvict(value = MovieTypeServiceImpl.CACHE_MOVIE_TYPE_NAME, allEntries = true),
                @CacheEvict(value = MovieTypeServiceImpl.CACHE_FIND_ALL, allEntries = true),
        })
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface CacheDeleteAll {
}
